A Loopless Algorithm for Generating Multiple Binary Tree Sequences Simultaneously

نویسندگان

  • Ro-Yu Wu
  • Jou-Ming Chang
  • Hung-Chang Chan
  • Kung-Jui Pai
چکیده

Pallo and Wu et al. respectively introduced the left-weight sequences (LW-sequences) and right-weight sequences (RW-sequences) for representing binary trees. In this paper, we introduce two new types of binary tree sequences called the left-child sequences (LC-sequences) and right-child sequences (RC-sequences). Next, we propose a loopless algorithm associated with rotations of binary trees for generating LW-, RW-, LC-, and RC-sequences simultaneously. Moreover, we show that LWand RW-sequences are generated in Gray-code order, and LCand RC-sequences are generated so that each sequence can be obtained from its predecessor by changing at most two digits. Our algorithm is shown to be more efficient in both space and time than the existing known algorithms.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Loopless Generation of Schröder Trees

The well-known Schröder numbers have appeared in different combinatorial contexts, including Schröder trees and well-weighted binary trees. The only loopless algorithm for generating Schröder trees actually generated representations for their well-weighted binary tree counterparts. This paper presents the first loopless algorithms for directly generating Schröder tree representations. They use ...

متن کامل

Generating Balanced Parentheses and Binary Trees by Prefix Shifts

We show that the set Bn of balanced parenthesis strings with n left and n right parentheses can be generated by prefix shifts. If b1, b2, . . . , b2n is a member of Bn, then the k-th prefix shift is the string b1, bk, b2, . . . , bk−1, bk+1, . . . , b2n. Prefix shift algorithms are also known for combinations, and permutations of a multiset; the combination algorithm appears in fascicles of Knu...

متن کامل

Ranking and Loopless Generation of k-ary Dyck Words in Cool-lex Order

A binary string B of length n = kt is a k-ary Dyck word if it contains t copies of 1, and the number of 0s in every prefix of B is at most k−1 times the number of 1s. We provide two loopless algorithms for generating k-ary Dyck words in cool-lex order: (1) The first requires two index variables and assumes k is a constant; (2) The second requires t index variables and works for any k. We also e...

متن کامل

Fixed-Density Necklaces and Lyndon Words in Cool-lex Order

This paper creates a simple Gray code for fixed-density binary necklaces and Lyndon words. The Gray code is simultaneously a left-shift Gray code and a 2-transposition Gray code and is cyclic with these properties. It also has the advantage of using canonical representations (lexicographically minimum rotations) yielding the first known Gray code for Lyndon words ordered by density. This work s...

متن کامل

A Loopless Gray Code for Minimal Signed-Binary Representations

A string . . . a2a1a0 over the alphabet {−1, 0, 1} is said to be a minimal signed-binary representation of an integer n if n = k≥0 ak2 k and the number of non-zero digits is minimal. We present a loopless (and hence a Gray code) algorithm for generating all minimal signed binary representations of a given integer n.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2013